package org.dairy.farms.nandana.web.controller;

import org.dairy.farms.model.Farm;
import org.dairy.farms.nandana.core.logic.FarmManagementLogic;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: gduggira
 * Date: Jun 16, 2011
 * Time: 4:05:39 PM
 */
@Controller
public class FarmController {
    private static final Logger logger = LoggerFactory.getLogger(FarmController.class);
    @Autowired
    private FarmManagementLogic farmManagementLogic;

    @RequestMapping(value="/farms/listFarms",method = RequestMethod.GET)
    public void listFarms(Model model){
        List<Farm> farmsList = farmManagementLogic.getAllFarms();
        model.addAttribute("farmsList",farmsList);
        //return "listFarms";
    }
}
